Drupal.behaviors.smsvidya_custom = function(){
	 // $('#edit-submit-job-seeker').val('');	 	
		//common validation function for preview and submit actions
		function onsubmitVal()
		{
			flag = false;
			//logo start			
			var company_logo = $('#edit-field-logo-0-upload');		
			if (company_logo.val() == '') {				
				$(company_logo).addClass('error');
				flag = true;
			}			
			//logo end
						
			//logo start			
			var country = $('#edit-field-country-0-country');		
			if (country.val() == '') {				
				$(country).addClass('error');
				flag = true;
			}
			//logo end
			
			 //company name start
			var company_name = $('#edit-field-company-name-0-value');		
			if (company_name.val() == 'Type your Business/Company name') {
				$(company_name).val('');
				$(company_name).addClass('error');
				flag = true;
			}
			//company name end
			
			//Email start
			var email = $('#edit-field-email-0-value');
			if (email.val() == 'Type your url/email-id') {
				$(email).val('');
				$(email).addClass('error');
				flag = true;
			}
			//Email end
			//skype start
			var skype = $('#edit-field-skype-0-value');
			if (skype.val() == 'Type your Skype address') {
				$(skype).val('');
				flag = true;
			}
			//skype end	
			//contact start
			var contact = $('#edit-field-contacts-0-value');		
			if (contact.val() == 'Type your address and or contact details') {
				$(contact).val('');
				flag = true;
			}
			//contact end
			
			//product or services start
			$("table#field_products_services_values input").each(function(){
				var product = "#"+ $(this).attr('id') +"";	
				if ($(product).val() == 'Type your product/service') {
					$(product).val('');
					flag = true;
				}
			});
			//product or services end
			//more start
			$("table#field_message_values input").each(function(){
				var more = "#"+ $(this).attr('id') +"";	 
				if ($(more).val() == 'Type your message line') {
					$(more).val('');
					flag = true;
				}				
			});
			//more end
			//keywords start
			$("table#field_keywords_values input").each(function(){
			var keyword = "#"+ $(this).attr('id') +""; 
				if ($(keyword).val() == 'Type a keyword') {
					$(keyword).val('');
					flag = true;
				}
			});
			//keyword end
			
			return flag;
		}
		$('div.leftarea #edit-preview').click(function(){
					stat = onsubmitVal();					 					
			if(stat)
			return false;			
			});
		$('div.leftarea #edit-submit').click(function(){
					stat = onsubmitVal();					 
			if(stat)
			return false;
		});
		
		
		var company_name = $('#edit-field-company-name-0-value');

		  if ($(company_name).val() == "") {
	       $(company_name).val('Type your Business/Company name');
           }
 
		$(company_name).focus(function(){
		if (company_name.val() == 'Type your Business/Company name') {
			$(company_name).val('');
		}
		});
		$(company_name).blur(function(){
		if (company_name.val() == '') {
				$(company_name).val('Type your Business/Company name');
		}
		});
		
		
		var email = $('#edit-field-email-0-value');

		  if ($(email).val() == "") {
	       $(email).val('Type your url/email-id');
           }
 
		$(email).focus(function(){
		if (email.val() == 'Type your url/email-id') {
			$(email).val('');
		}
		});
		$(email).blur(function(){
		if (email.val() == '') {
				$(email).val('Type your url/email-id');
		}
		});
		
		var skype = $('#edit-field-skype-0-value');

		  if ($(skype).val() == "") {
	       $(skype).val('Type your Skype address');
           }
 
		$(skype).focus(function(){
		if (skype.val() == 'Type your Skype address') {
			$(skype).val('');
		}
		});
		$(skype).blur(function(){
		if (skype.val() == '') {
				$(skype).val('Type your Skype address');
		}
		});


		var contact = $('#edit-field-contacts-0-value');

		  if ($(contact).val() == "") {
	       $(contact).val('Type your address and or contact details');
           }
 
		$(contact).focus(function(){
		if (contact.val() == 'Type your address and or contact details') {
			$(contact).val('');
		}
		});		
		$(contact).blur(function(){
		if (contact.val() == '') {
				$(contact).val('Type your address and or contact details');
		}		
		});
			
		
		$("table#field_products_services_values input").each(function(){
	var product = "#"+ $(this).attr('id') +"";

	if ($(product).val() == "") {
	       $(product).val('Type your product/service');
           }
 
		$(product).focus(function(){
		if ($(product).val() == 'Type your product/service') {
			$(product).val('');
		}
		});
		$(product).blur(function(){
		if ($(product).val() == '') {
				$(product).val('Type your product/service');
		}
		});
});
		
		$("table#field_message_values input").each(function(){
var more = "#"+ $(this).attr('id') +"";

if ($(more).val() == "") {
	       $(more).val('Type your message line');
           }
 
		$(more).focus(function(){
		if ($(more).val() == 'Type your message line') {
			$(more).val('');
		}
		});
		$(more).blur(function(){
		if ($(more).val() == '') {
				$(more).val('Type your message line');
		}
		});
});
$('#edit-field-keywords-field-keywords-add-more').val('');
$('#edit-field-products-services-field-products-services-add-more').val('');
$('#edit-field-message-field-message-add-more').val('');
$("input[type=submit][value=Upload]").removeClass('ahah-processed');
var len = $("#edit-field-products-services-5-value").length;
if(len == 1)
{
	$('#edit-field-products-services-field-products-services-add-more').hide();
}
var len = $("#edit-field-message-5-value").length;
if(len == 1)
{
	$('#edit-field-message-field-message-add-more').hide();
}
var len = $("#edit-field-keywords-5-value").length;
if(len == 1)
{
	$('#edit-field-keywords-field-keywords-add-more').hide();
}
$("table#field_keywords_values input").each(function(){
var keyword = "#"+ $(this).attr('id') +"";

if ($(keyword).val() == "") {
	       $(keyword).val('Type a keyword');
           }
 
		$(keyword).focus(function(){
		if ($(keyword).val() == 'Type a keyword') {
			$(keyword).val('');
		}
		});
		$(keyword).blur(function(){
		if ($(keyword).val() == '') {
				$(keyword).val('Type a keyword');
		}
		});
});


//$('input#edit-preview').click(function(){alert($('div.card_preview_area').html());})

}